package org.kmp.project.main.account
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.kmp.project.NavigationManager
import org.kmp.project.main.account.detail.AccountDetail
import org.kmp.project.util.showToast

class Account{

    val viewModel = AccountViewModel()

    @Composable
    fun screen(modifier: Modifier = Modifier) {

        Column(
            modifier = modifier
                .fillMaxSize()
                .padding(16.dp)
        ) {
            Text("设置", modifier = Modifier.padding(bottom = 16.dp))

            Column(
                verticalArrangement = Arrangement.spacedBy(16.dp)
            ) {
                Row(
                    modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement = Arrangement.SpaceBetween,
                    verticalAlignment = Alignment.CenterVertically
                ) {
                    Text("通知提醒")
                    Switch(
                        checked = viewModel.notificationsEnabled,
                        onCheckedChange = { viewModel.notificationsEnabled=it }
                    )
                }

                Button(onClick = {
                    val accountDetail= AccountDetail().setParams("aaabbbccc")
                    NavigationManager.navigateTo(accountDetail){
                        showToast(it as String)
                    }
                }) {
                    Text("跳转页面")
                }
            }
        }
    }
}
